<template>

	<view class="container">
		<uni-section>
			<view class="uni-padding-wrap uni-common-mt">
				<uni-segmented-control :current="current" :values="items" :style-type="styleType"
					:active-color="activeColor" @clickItem="onClickItem" />
			</view>
			<view class="content">
				<view v-if="current === 0" v-for="(item,index) in detailData">
					<uni-list border-full @click="defaultOrders(item)">
						<uni-list-item :title="item.cl" :note="item.mc" :rightText="'分类:'+item.lb" />
					</uni-list>
				</view>
				<view v-if="current === 1" v-for="(item,index) in examineData" >
					<uni-list border-full @click="examine(item)">
						<uni-list-item :title="item.lx" :note="item.mc" :rightText="'状态:'+item.zt" />
					</uni-list>
				</view>
				<view v-if="current === 2" v-for="(item,index) in inspectionData">
					<uni-list border-full  @click="lispection(item)">
						<uni-list-item :title="item.zxmname" :note="item.zxmbb" :rightText="'状态:'+item.zt" />
					</uni-list>
				</view>
			</view>
		</uni-section>
	</view>
</template>

<script>
	import { OrdersQuery,examineQuery, inspectionQuery } from '../../api/huanzhe.js'
	export default {
		data() {
			// 病情判断，体征录入，入出量记录，生命体征，物资信息列表，入出量，药房捡药，物资消耗，检验，物资查看，医嘱执行，后送执行，日常护理记录，结果录入，检查，输血记录，伤员接收，伤员护理记录，套餐医嘱，扫一扫，扫码结果
			return {
				items: ['默认', '检查', '检验'],
				styleType: 'text',
				current: 0,
				detailData:[],
				examineData:[],
				inspectionData:[]
			}
		},
		onLoad(option){
			this.queryOrdersOpen(option)
			this.queryExamine(option.hzId)
			this.queryInspection(option.hzId)
		},
		methods: {
			// 查看检验
			queryInspection(hzId){
				inspectionQuery(hzId).then(res=>{
					console.log(res.rows);
					this.inspectionData=res.rows
				})
			},
			// 查看检查
			queryExamine(hzId){
				examineQuery(hzId).then(res=>{
					this.examineData=res.rows
				})
			},
			// 查询已开医嘱
			queryOrdersOpen(hzId){
				OrdersQuery(hzId).then(res=>{
					this.detailData=res.rows
				})
			},
			onClickItem(e) {
				if (this.current !== e.currentIndex) {
					this.current = e.currentIndex
				}
			},
			defaultOrders(item){
				uni.navigateTo({
					url:'/pages/casualtyList/detailOrders?xm='+item.xm+'&cl='+item.cl+'&lb='+item.lb+'&yzlr='+item.mc+'&jl='+item.jl+'&dw='+item.jldw+'&pc='+item.pc+'&tj='+item.tj+'&zrys='+item.sqname+'&bz='+item.bz+'&sj='+item.sj
				})
			},
			// 检查
			examine(item){
				console.log(item.lx);
				uni.navigateTo({
					url:'/pages/examine/index?lx='+item.lx+'&mc='+item.mc+'&sj='+item.sj+'&zt='+item.zt
				})
			},
			// 检验
			lispection(item){
				uni.navigateTo({
					url:'/pages/Inspection/index?xm='+item.zxmname+'&bb='+item.zxmbb+'&sj='+item.sj+'&zt='+item.zt
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
</style>